'\" te
.\" This manual page is derived from the DAT/uDAPL 1.2 specification.
.\" Portions Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH DAT_LMR_CREATE 3DAT "Jan 28, 2009"
.SH NAME
dat_lmr_create \- register a memory region with an IA
.SH SYNOPSIS
.LP
.nf
cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-ldat\fR [ \fIlibrary\fR\&.\|.\|. ]
#include <\fBdat/udat.h\fR>

DAT_RETURN
    dat_lmr_create (
    IN    DAT_IA_HANDLE          ia_handle,
    IN    DAT_MEM_TYPE           mem_type,
    IN    DAT_REGION_DESCRIPTION region_description,
    IN    DAT_VLEN               length,
    IN    DAT_PZ_HANDLE          pz_handle,
    IN    DAT_MEM_PRIV_FLAGS     mem_privileges,
    OUT   DAT_LMR_HANDLE         *lmr_handle,
    OUT   DAT_LMR_CONTEXT        *lmr_context,
    OUT   DAT_RMR_CONTEXT        *rmr_context,
    OUT   DAT_VLEN               *registered_size,
    OUT   DAT_VADDR              *registered_address
    )
.fi

.SH PARAMETERS
.sp
.ne 2
.na
\fB\fIia_handle\fR\fR
.ad
.sp .6
.RS 4n
Handle for an open instance of the IA.
.RE

.sp
.ne 2
.na
\fB\fImem_type\fR\fR
.ad
.sp .6
.RS 4n
Type of memory to be registered. The following list outlines the memory type
specifications.
.sp
.ne 2
.na
\fB\fBDAT_MEM_TYPE_VIRTUAL\fR\fR
.ad
.sp .6
.RS 4n
Consumer virtual memory.
.sp
Region description: A pointer to a contiguous user virtual range.
.sp
Length: Length of the Memory Region.
.RE

.sp
.ne 2
.na
\fB\fBDAT_MEM_TYPE_SO_VIRTUAL\fR\fR
.ad
.sp .6
.RS 4n
Consumer virtual memory with strong memory ordering. This type is a Solaris
specific addition. If the \fIia_handle\fR was opened without \fBRO_AWARE_\fR
(see \fBdat_ia_open\fR(3DAT)), then type \fBDAT_MEM_TYPE_VIRTUAL\fR is
implicitly converted to this type.
.sp
Region description: A pointer to a  contiguous  user virtual range.
.sp
Length: Length of the Memory Region.
.RE

.sp
.ne 2
.na
\fB\fBDAT_MEM_TYPE_LMR\fR\fR
.ad
.sp .6
.RS 4n
LMR.
.sp
Region description: An LMR_handle.
.sp
Length: Length parameter is ignored.
.RE

.sp
.ne 2
.na
\fB\fBDAT_MEM_TYPE_SHARED_VIRTUAL\fR\fR
.ad
.sp .6
.RS 4n
Shared memory region. All DAT Consumers of the same uDAPL Provider specify the
same Consumer cookie to indicate who is sharing the shared memory region. This
supports a peer-to-peer model of shared memory. All DAT Consumers of the shared
memory must allocate the memory region as shared memory using Platform-specific
primitives.
.sp
Region description: A structure with 2 elements, where the first one is of type
\fBDAT_LMR_COOKIE\fR and is a unique identifier of the shared memory region,
and the second one is a pointer to a contiguous user virtual range.
.sp
Length: Length of the Memory Region
.RE

.RE

.sp
.ne 2
.na
\fB\fIregion_description\fR\fR
.ad
.sp .6
.RS 4n
Pointer to type-specific data describing the memory in the region to be
registered. The type is derived from the \fImem_type\fR parameter.
.RE

.sp
.ne 2
.na
\fB\fIlength\fR\fR
.ad
.sp .6
.RS 4n
Length parameter accompanying the region_description.
.RE

.sp
.ne 2
.na
\fB\fIpz_handle\fR\fR
.ad
.sp .6
.RS 4n
Handle for an instance of the Protection Zone.
.RE

.sp
.ne 2
.na
\fB\fImem_privileges:\fR\fR
.ad
.sp .6
.RS 4n
Consumer-requested memory access privileges for the registered local memory
region. The Default value is \fBDAT_MEM_PRIV_NONE_FLAG\fR. The constant value
\fBDAT_MEM_PRIV_ALL_FLAG\fR = 0x33, which specifies both Read and Write
privileges, is also defined. Memory privilege definitions are as follows:
.sp
.ne 2
.na
\fBLocal Read\fR
.ad
.RS 16n
\fBDAT_MEM_PRIV_LOCAL_READ_FLAG\fR
.sp
.ne 2
.na
\fB0x01\fR
.ad
.RS 8n
Local read access requested.
.RE

.RE

.sp
.ne 2
.na
\fBLocal Write\fR
.ad
.RS 16n
\fBDAT_MEM_PRIV_LOCAL_WRITE_FLAG\fR
.sp
.ne 2
.na
\fB0x10\fR
.ad
.RS 8n
Local write access requested.
.RE

.RE

.sp
.ne 2
.na
\fBRemote Read\fR
.ad
.RS 16n
\fBDAT_MEM_PRIV_REMOTE_READ_FLAG\fR
.sp
.ne 2
.na
\fB0x02\fR
.ad
.RS 8n
Remote read access requested.
.RE

.RE

.sp
.ne 2
.na
\fBRemote Write\fR
.ad
.RS 16n
\fBDAT_MEM_PRIV_REMOTE_WRITE_FLAG\fR
.sp
.ne 2
.na
\fB0x20\fR
.ad
.RS 8n
Remote write access requested.
.RE

.RE

.RE

.sp
.ne 2
.na
\fB\fIlmr_handle\fR\fR
.ad
.sp .6
.RS 4n
Handle for the created instance of the LMR.
.RE

.sp
.ne 2
.na
\fB\fIlmr_context\fR\fR
.ad
.sp .6
.RS 4n
Context for the created instance of the LMR to use for DTO local buffers.
.RE

.sp
.ne 2
.na
\fB\fIregistered_size\fR\fR
.ad
.sp .6
.RS 4n
Actual memory size registered by the Provider.
.RE

.sp
.ne 2
.na
\fB\fIregistered_address\fR\fR
.ad
.sp .6
.RS 4n
Actual base address of the memory registered by the Provider.
.RE

.SH DESCRIPTION
.sp
.LP
The \fBdat_lmr_create()\fR function registers a memory region with an IA. The
specified buffer must have been previously allocated and pinned by the uDAPL
Consumer on the platform. The Provider must do memory pinning if needed, which
includes whatever OS-dependent steps are required to ensure that the memory is
available on demand for the Interface Adapter. uDAPL does not require that the
memory never be swapped out; just that neither the hardware nor the Consumer
ever has to deal with it not being there. The created \fIlmr_context\fR can be
used for local buffers of DTOs and for binding RMRs, and \fIlmr_handle\fR can
be used for creating other LMRs. For uDAPL the scope of the \fIlmr_context\fR
is the address space of the DAT Consumer.
.sp
.LP
The return values of \fIregistered_size\fR and \fIregistered_address\fR
indicate to the Consumer how much the contiguous region of Consumer virtual
memory was registered by the Provider and where the region starts in the
Consumer virtual address.
.sp
.LP
The \fImem_type\fR parameter indicates to the Provider the kind of memory to be
registered, and can take on any of the values defined in the table in the
PARAMETERS section.
.sp
.LP
The \fIpz_handle\fR parameter allows Consumers to restrict local accesses to
the registered LMR by DTOs.
.sp
.LP
\fBDAT_LMR_COOKIE\fR is a pointer to a unique identifier of the shared memory
region of the \fBDAT_MEM_TYPE_SHARED_VIRTUAL\fR DAT memory type. The identifier
is an array of 40 bytes allocated by the Consumer. The Provider must check the
entire 40 bytes and shall not interpret it as a null-terminated string.
.sp
.LP
The return value of \fIrmr_context\fR can be transferred by the local Consumer
to a Consumer on a remote host to be used for an RDMA DTO.
.sp
.LP
If \fImem_privileges\fR does not specify remote Read and Write privileges,
\fIrmr_context\fR is not generated and \fINULL\fR is returned. No remote
privileges are given for Memory Region unless explicitly asked for by the
Consumer.
.SH RETURN VALUES
.sp
.ne 2
.na
\fB\fBDAT_SUCCESS\fR\fR
.ad
.RS 30n
The operation was successful.
.RE

.sp
.ne 2
.na
\fB\fBDAT_UNSUFFICIENT_RESOURCES\fR\fR
.ad
.RS 30n
The operation failed due to resource limitations.
.RE

.sp
.ne 2
.na
\fB\fBDAT_INVALID_PARAMETER\fR\fR
.ad
.RS 30n
Invalid parameter.
.RE

.sp
.ne 2
.na
\fB\fBDAT_INVALID_HANDLE\fR\fR
.ad
.RS 30n
Invalid DAT handle.
.RE

.sp
.ne 2
.na
\fB\fBDAT_INVALID_STATE\fR\fR
.ad
.RS 30n
Parameter in an invalid state. For example, shared virtual buffer was not
created shared by the platform.
.RE

.sp
.ne 2
.na
\fB\fBDAT_MODEL_NOT_SUPPORTED\fR\fR
.ad
.RS 30n
The requested Model was not supported by the Provider. For example, requested
Memory Type was not supported by the Provider.
.RE

.SH USAGE
.sp
.LP
Consumers can create an LMR over the existing LMR memory with different
Protection Zones and privileges using previously created IA translation table
entries.
.sp
.LP
The Consumer should use \fIrmr_context\fR with caution. Once advertised to a
remote peer, the \fIrmr_context\fR of the LMR cannot be invalidated. The only
way to invalidate it is to destroy the LMR with \fBdat_lmr_free\fR(3DAT).
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(7) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Interface Stability	Committed
_
MT-Level	Safe
_
Standard	T{
uDAPL, 1.1, 1.2 (except \fBDAT_MEM_TYPE_SO_VIRTUAL\fR)
T}
.TE

.SH SEE ALSO
.sp
.LP
.BR dat_lmr_free (3DAT),
.BR libdat (3LIB),
.BR attributes (7)
